<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Edit a Vehicle</title>
    </h:head>
    <h:body>
        <f:view>
            <h:form>
                <h:panelGrid columns="2" border="1">
                    <f:facet name="header">
                        <h:outputText value="Enter Vehicle Information"/>
                    </f:facet>
                    <h:outputLabel value="Name"/>
                    <h:inputText value="#{vehicle.editableVehicle.name}"/>
                    <h:outputLabel value="Vehicle Type" />
                    
                    <h:selectOneMenu id ="typeHolder" value="#{vehicle.editableVehicle.vehicleTypeID}">
                        <c:forEach var="vehicleType" items="#{vehicleType.vehicleTypes}">
                            <f:selectItem itemValue="#{vehicleType.id}" itemLabel="#{vehicleType.name}"/>
                        </c:forEach>
                    </h:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:commandButton action="#{vehicle.editableVehicle.saveVehicle}" value="Submit" />
                <br />
                <h:commandButton action="vehicleList" value="Cancel"/>
                <br />
                <h:messages />
            </h:form>
        </f:view>
    </h:body>
</html>

